<?php

abstract class Session_Adapter
{
	/**
	 * @var int
	 */
	protected $_lifetime = null;

	/**
	 * @var string
	 */
	protected $_path = null;

	/**
	 * @var string
	 */
	protected $_name = null;

	/**
	 * @param int $value
	 * @return Session_Engine
	 */
	public function setLifetime($value)
	{
		$this -> _lifetime = intval($value);
		return $this;
	}

	/**
	 * Retrieve session lifetime
	 *
	 * @return int
	 */
	public function getLifetime()
	{
		if (null == $this -> _lifetime)
		{
			return 86400;
		}
		return $this -> _lifetime;
	}

	/**
	 * Open Session
	 *
	 * @param string $save_path
	 * @param string $name
	 * @return boolean
	 */
	public function open($path, $name)
	{
		$this -> _path = $path;
		$this -> _name = $name;
		return true;
	}

	/**
	 * Close session
	 *
	 * @return boolean
	 */
	public function close()
	{
		return true;
	}

	abstract function read($id);

	abstract function write($id, $data);

	abstract function destroy($id);

	abstract function gc($maxlifetime);
}
